import request from '../utils/request'

// 获取自动回复规则列表
export function getAutoReplies(query) {
  return request({
    url: '/api/auto_replies',
    method: 'get',
    params: { q: query }
  })
}

// 获取单个自动回复规则
export function getAutoReply(id) {
  return request({
    url: `/api/auto_replies/${id}`,
    method: 'get'
  })
}

// 创建自动回复规则
export function createAutoReply(data) {
  return request({
    url: '/api/auto_replies',
    method: 'post',
    data
  })
}

// 更新自动回复规则
export function updateAutoReply(id, data) {
  return request({
    url: `/api/auto_replies/${id}`,
    method: 'put',
    data
  })
}

// 删除自动回复规则
export function deleteAutoReply(id) {
  return request({
    url: `/api/auto_replies/${id}`,
    method: 'delete'
  })
}

// 处理自动回复
export function processAutoReply(data) {
  return request({
    url: '/api/auto_replies/process',
    method: 'post',
    data
  })
}